(function() {
	Wallet.widget.HtmlDataTable = function(el, config) {
		var columnDefs = this.columnDefs;
		
		var dataSource = this.dataSource = this._getDataSource(config.dataSource);
			
		Wallet.widget.HtmlDataTable.superclass.constructor.call(this, el, columnDefs, dataSource, config);	
		
		this.initDomElements();
		
		this.initListeners();	
	}
	
	var Lang = YAHOO.lang,
		DataTable = YAHOO.widget.DataTable,
		DataSource = YAHOO.util.DataSource,
		Dom = YAHOO.util.Dom,
		HtmlDataTable = Wallet.widget.HtmlDataTable;
		
	Lang.extend(HtmlDataTable, DataTable, {
		initAttributes: function(attr) {
			HtmlDataTable.superclass.initAttributes.call(this, attr);
			
			this.setAttributeConfig("dataSource", {
	            value: attr.dataSource,
	            method: function(value) {
	            	//alert("DATASOURCE::" + value);
	            },
	            validator: function(value) {
	            	return Lang.isString(value) || Lang.isObject(value);
	            }
        	});
		},
		initDomElements: function() {			
			YAHOO.util.Dom.addClass(this._elTable, "full-width");
		},
		initListeners: function() {
			this.addListener("rowMouseoverEvent", this.onEventHighlightRow);   
			this.addListener("rowMouseoutEvent", this.onEventUnhighlightRow);
			
			this.addListener("rowClickEvent", this.onEventSelectRow);
		},
		onEventSelectRow: function(args) {		
			HtmlDataTable.superclass.onEventSelectRow.call(this, args);
			
		},
		_getDataSource: function(dataSourceEl) {		
			Dom.setStyle(dataSourceEl, "display", "none");
			
			var dataSource = new DataSource(Dom.get(dataSourceEl));
	
			dataSource.responseType = this.responseType;
			dataSource.responseSchema = this.responseSchema;
			
			return dataSource;
		}
	});	
}());